#pragma once
#include "reactor/noncopyable.hpp"
#include <thread>
#include <mutex>
#include <condition_variable>

namespace reactor {
class EventLoop;

/**
 * @brief 将 EventLoop 运行在单独线程中的封装
 */
class EventLoopThread : noncopyable {
public:
    EventLoopThread();
    ~EventLoopThread();
    EventLoop* startLoop();

private:
    void threadFunc();

    EventLoop* _loop;
    std::thread _thread;
    std::mutex _mutex;
    std::condition_variable _cond;
};
} // namespace reactor
